package datastructure.selfexercise;

import java.security.Key;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

/**
 * @Author Gan
 * @Date 2021/5/6 9:06
 * @Description: 练习API
 */
public class MyHashMap {
    public static void main(String[] args) {
        HashMap<Integer, String> map = new HashMap<>();
        HashMap<Integer, String> map1 = new HashMap<>();
        map1.put(0,"hdu");
        map.put(1, "zs");
        map.put(2, "zl");
        map.put(3, "wu");
        map.put(4, "we");
        //后来者覆盖，去除重复
        map.put(4, "ru");
        ArrayList<String> arrayList = new ArrayList<>();
        Iterator<String> it = arrayList.iterator();

        Iterator iterator = map.keySet().iterator();
        while (iterator.hasNext()) {
            Object key = iterator.next();
            System.out.println("map.get(key) is :"+map.get(key));
        }
        System.out.println(map.containsKey(2));
        System.out.println(map.containsValue("wu"));

        /* for (Integer it : map.keySet()) {
            System.out.println("map.get(it) is " + map.get(it));
        }*/
        //返回此映射所包含的映射关系的 Set 视图。
        System.out.println(map.entrySet());

    }
}
